package com.zimi.util;

import com.zimi.bean.Constants;
import com.zimi.model.SysUser;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;

@Slf4j
public class UserUtil {
    public static SysUser getUser() {
        Subject currentUser = SecurityUtils.getSubject();
        Session session = currentUser.getSession();
        return (SysUser) session.getAttribute(Constants.USER_SESSION_KEY);
    }
}
